{extend name="./tpl/default/mobile/public/layout.html" /}
{block name="header"}
<link rel="stylesheet" href="/public/home/mobile/css/gongyong.css">
{/block}
{block name="head"}
<div class="head" style="background: #424242;">
    <span class="head_lf"><a onclick="history.back(-1)">返回</a></span>

    用户注册

    <span class="head_rg"><a onclick="history.back(-1)">登录</a></span>
</div>

{/block}
{block name="body"}
<form action="" id="form">
    <div class="zhuce">
        <div class="text">
            <span>手机号</span>
            <input type="text" placeholder="请输入手机号" id="username" name="username" class="input">
        </div>
        <!--<div class="text">-->
            <!--<span>验证码</span>-->
            <!--<input type="text" placeholder="请输入验证码" id="reg-vcode" class="input" style="width:55%">-->
            <!--<span class="yzm">-->
        <!--<img src="{:captcha_src()}" alt="captcha"-->
             <!--onclick="$(this).attr('src','{:captcha_src()}?time='+(new Date()).valueOf())" style="width:22vw;">-->
    <!--</span>-->
        <!--</div>-->
        <div class="text">
            <span>验证码</span>
            <input type="text" placeholder="请输入验证码" class="input" name="code" style="width:50%">
            <span class="yzm"><input type="button" value="获取验证码" onclick="sendSms()"></span>
        </div>
        <div class="text">
            <span>昵 称</span>
            <input type="text" placeholder="请输入昵称" name="name" class="input">
        </div>
        <div class="text">
            <span>密 码</span>
            <input type="password" placeholder="请输入密码" name="password" class="input">
        </div>
        <div class="text">
            <span>确认密码</span>
            <input type="password" placeholder="请输入确认密码" name="repassword" class="input">
        </div>
        <div class="tip"><a href="#"><input type="checkbox" checked="checked">同意注册条款</a></div>
        <div class="btndl"><input type="button" onclick="ajaxSubForm()" value="注 册" style="background: #bdbdbd;"></div>
    </div>
</form>
{/block}
{block name="script"}
{:widget('common/Form/validRes')}
<script src="/public/common.js"></script>
<script src="/public/plugins/layerMobile/layer.js"></script>
<script type="text/javascript">
    function ajaxSubForm() {
        var data = $('#form').serialize();
        $.post('{:get_current_url()}', data, function (data) {
            layer.open({
                content: data.msg
                , skin: 'msg'
                , time: 5 //2秒后自动关闭
            });
            if (data.url) {
                location.href = data.url
            }
        })
    }

    function sendSms() {
        var to = $('#username').val();
        var vcode = $('#reg-vcode').val();
        $.post('/home/Public/sendSms', {to: to, vcode: vcode}, function (data) {
            layer.open({
                content: data.msg
                , skin: 'msg'
                , time: 5 //2秒后自动关闭
            });
        })
    }
</script>
{/block}
